From 2e52386be525cfdc475794459c521740c6e0baa0 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 2 Dec 2020 13:44:23 -0800 Subject: [PATCH] macos: send focus-out event to windowing --- gdk/macos/gdkmacosdisplay.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/gdk/macos/gdkmacosdisplay.c b/gdk/macos/gdkmacosdisplay.c index 1ac55ad82f..9772059bcf 100644 --- a/gdk/macos/gdkmacosdisplay.c +++ b/gdk/macos/gdkmacosdisplay.c @@ -519,23 +519,30 @@ void _gdk_macos_display_surface_resigned_key (GdkMacosDisplay *self, GdkMacosSurface *surface) { + gboolean was_keyboard_surface; + g_return_if_fail (GDK_IS_MACOS_DISPLAY (self)); g_return_if_fail (GDK_IS_MACOS_SURFACE (surface)); - if (self->keyboard_surface == surface) + was_keyboard_surface = self->keyboard_surface == surface; + + self->keyboard_surface = NULL; + + if (was_keyboard_surface) { GdkDevice *keyboard; GdkEvent *event; GdkSeat *seat; + GList *node; seat = gdk_display_get_default_seat (GDK_DISPLAY (self)); keyboard = gdk_seat_get_keyboard (seat); event = gdk_focus_event_new (GDK_SURFACE (surface), keyboard, FALSE); - _gdk_event_queue_append (GDK_DISPLAY (self), event); + node = _gdk_event_queue_append (GDK_DISPLAY (self), event); + _gdk_windowing_got_event (GDK_DISPLAY (self), node, event, + _gdk_display_get_next_serial (GDK_DISPLAY (self))); } - self->keyboard_surface = NULL; - _gdk_macos_display_clear_sorting (self); } -- 2.30.2